# Contributor: Martin Schmidt <martin.schmidt13@gmx.de>
# Maintainer: Martin Schmidt <martin.schmidt13@gmx.de>
_commit=f4fe74056d0474b42025d95449ec859e984d78ea
pkgname=mediastreamer2-plugin-x264
pkgver=20200722
pkgrel=5
pkgdesc="GPL plugin to bring video H264 encoding/decoding capabilities to mediastreamer2 applications"
url="https://gitlab.linphone.org/BC/public/msx264"
arch="all"
license="GPL-2.0-or-later"
options="!check" # no test available
makedepends="cmake ortp-dev bctoolbox-dev mediastreamer2-dev x264-dev samurai"
source="$pkgname-$_commit.tar.gz::https://gitlab.linphone.org/BC/public/msx264/-/archive/$_commit.tar.gz
	no-werror.patch
	"

builddir="$srcdir/msx264-$_commit"

prepare() {
	default_prepare
	sed -i 's/ORTP\ REQUIRED/ortp\ REQUIRED/g' src/CMakeLists.txt
}

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_MODULE_PATH=/usr/lib/cmake \
		-DCMAKE_SKIP_INSTALL_RPATH=ON \
		-DENABLE_SHARED=YES

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}
sha512sums="
cc295d06b13fddaf97669ef20bf239622ea0690bd8d193df0f435831caf433f5b036be83bfdd9a261af8d51c272d4e2b614cfd2af04766797c86314d46782065  mediastreamer2-plugin-x264-f4fe74056d0474b42025d95449ec859e984d78ea.tar.gz
aa8663ea222d6152fe9a101a3060a668876f22875bbc496b6e549a00a2660a3e9eeb95cda2189431968934ace90cabad7575d76ae65127171d10f84f2589567f  no-werror.patch
"
